﻿<UserControl x:Class="CAION2.Controls.ItemCard"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mui="clr-namespace:FirstFloor.ModernUI.Windows.Controls;assembly=FirstFloor.ModernUI"
             xmlns:resources="clr-namespace:CAION2.Properties"
             xmlns:viewModels="clr-namespace:CAION2.ViewModels"
             FontFamily="/Fonts/UbuntuMono-R.ttf#Ubuntu Mono"
             Width="420"
             Tag="{Binding CardTag}"
             Visibility="{Binding CardVisible}">

    <UserControl.DataContext>
        <viewModels:ItemCardViewModel />
    </UserControl.DataContext>

    <UserControl.Resources>

        <viewModels:IconConverter x:Key="IconConverter" />
        <viewModels:TextLenghtToVisibleConverter x:Key="TextLenghtToVisibleConverter" />

        <ContextMenu x:Key="ManastoneMenu">
            <MenuItem Command="{Binding CopyManastoneCommand}"
                      CommandParameter="{Binding RelativeSource={RelativeSource AncestorType={x:Type ContextMenu}},
                                                 Path=PlacementTarget}"
                      Header="{x:Static resources:Resources.Manastones_MenuCopy}" />
            <MenuItem Command="{Binding DeleteManastoneCommand}"
                      CommandParameter="{Binding RelativeSource={RelativeSource AncestorType={x:Type ContextMenu}},
                                                 Path=PlacementTarget}"
                      Header="{x:Static resources:Resources.Manastones_MenuDelete}" />
        </ContextMenu>

        <ContextMenu x:Key="ArmsfusionManastoneMenu">
            <MenuItem Command="{Binding CopyArmsfusionManastoneCommand}"
                      CommandParameter="{Binding RelativeSource={RelativeSource AncestorType={x:Type ContextMenu}},
                                                 Path=PlacementTarget}"
                      Header="{x:Static resources:Resources.Manastones_MenuCopy}" />
            <MenuItem Command="{Binding DeleteArmsfusionManastoneCommand}"
                      CommandParameter="{Binding RelativeSource={RelativeSource AncestorType={x:Type ContextMenu}},
                                                 Path=PlacementTarget}"
                      Header="{x:Static resources:Resources.Manastones_MenuDelete}" />
        </ContextMenu>
        
        <Style x:Key="ManastoneButtonStyle"
               BasedOn="{StaticResource BaseButtonStyle}"
               TargetType="Button">
            <Setter Property="Padding" Value="0" />
            <Setter Property="Margin" Value="3" />
            <Setter Property="Height" Value="26" />
            <Setter Property="Width" Value="26" />
            <Setter Property="ContextMenu" Value="{StaticResource ManastoneMenu}" />
        </Style>

        <Style x:Key="ArmsfusionManastoneButtonStyle"
               BasedOn="{StaticResource BaseButtonStyle}"
               TargetType="Button">
            <Setter Property="Padding" Value="0" />
            <Setter Property="Margin" Value="3" />
            <Setter Property="Height" Value="26" />
            <Setter Property="Width" Value="26" />
            <Setter Property="ContextMenu" Value="{StaticResource ArmsfusionManastoneMenu}" />
        </Style>

        <Style TargetType="TextBlock">
            <Setter Property="TextOptions.TextFormattingMode" Value="Display" />
            <Setter Property="TextOptions.TextHintingMode" Value="Fixed" />
            <Setter Property="TextOptions.TextRenderingMode" Value="Auto" />
        </Style>

        <Style TargetType="mui:BBCodeBlock">
            <Setter Property="TextOptions.TextFormattingMode" Value="Display" />
            <Setter Property="TextOptions.TextHintingMode" Value="Fixed" />
            <Setter Property="TextOptions.TextRenderingMode" Value="Auto" />
        </Style>

    </UserControl.Resources>

    
    <Grid VerticalAlignment="Stretch"
            HorizontalAlignment="Stretch">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="48" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>

        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" MaxHeight="44" />
            <RowDefinition Height="*" />
            <RowDefinition Height="40" />
        </Grid.RowDefinitions>

        <StackPanel Grid.RowSpan="2"
                    Grid.Column="1"
                    HorizontalAlignment="Right"
                    Orientation="Vertical"
                    Visibility="{Binding ItemsSelectorVisible}">
            <RadioButton Command="{Binding ChangeSelectionIndexCommand}"
                            CommandParameter="0" />
            <RadioButton Command="{Binding ChangeSelectionIndexCommand}"
                            CommandParameter="1" />
        </StackPanel>

        <TextBlock Grid.Row="0" Grid.ColumnSpan="2" Grid.Column="0"
                    Margin="4,0,30,0"
                    FontSize="16"
                    Foreground="{Binding TranslateColor}"
                    Text="{Binding TranslateName}"
                    TextWrapping="Wrap">
            <TextBlock.Effect>
                <DropShadowEffect BlurRadius="1"
                                    Direction="315"
                                    Opacity="1"
                                    ShadowDepth="1"
                                    Color="Black" />
            </TextBlock.Effect>
        </TextBlock>

        <Border Grid.Row="1" Grid.Column="0"
                Width="44"
                Height="44"
                Margin="4,4,0,0"
                HorizontalAlignment="Left"
                VerticalAlignment="Top">
            <Image Width="40"
                    Height="40"
                    HorizontalAlignment="Center"
                    VerticalAlignment="Center"
                    Source="{Binding Icon}" />
            <Border.Background>
                <ImageBrush ImageSource="/CAION2;component/UI2/IconSlot.png" />
            </Border.Background>
        </Border>

        <Border Grid.Row="1" Grid.Column="0"
                Width="44"
                Height="44"
                Margin="4,52,0,0"
                HorizontalAlignment="Left"
                VerticalAlignment="Top">
            <Image Width="40"
                    Height="40"
                    HorizontalAlignment="Center"
                    VerticalAlignment="Center" />
            <Border.Background>
                <ImageBrush ImageSource="/CAION2;component/UI2/GodStoneSlot.png" />
            </Border.Background>
        </Border>

        <ScrollViewer HorizontalScrollBarVisibility="Disabled" 
                        VerticalScrollBarVisibility="Auto"
                        Grid.Row="1"
                        Grid.Column="1"
                        Visibility="{Binding PagesVisible[0]}">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="24" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>

            <StackPanel Margin="4,4,30,4" Orientation="Vertical">
                <TextBlock HorizontalAlignment="Left" 
                           Text="{Binding ItemType}" 
                           Visibility="{Binding ItemType, Converter={StaticResource TextLenghtToVisibleConverter}}" />
                <TextBlock HorizontalAlignment="Left" 
                           Text="{Binding ItemSpeed}" 
                           Visibility="{Binding ItemSpeed, Converter={StaticResource TextLenghtToVisibleConverter}}" />
                <TextBlock HorizontalAlignment="Stretch" 
                           Text="{Binding ItemLevel}" 
                           Visibility="{Binding ItemLevel, Converter={StaticResource TextLenghtToVisibleConverter}}" />
                <TextBlock HorizontalAlignment="Left"
                           FontSize="11"
                           Foreground="{DynamicResource ItemTextDisabled}"
                           Text="{Binding ItemSoul}" 
                           Visibility="{Binding ItemSoul, Converter={StaticResource TextLenghtToVisibleConverter}}" />
                <TextBlock HorizontalAlignment="Left" 
                           Text="{Binding ItemExchange}" />
            </StackPanel>

            <StackPanel Grid.Row="1"
                        Margin="4,0,0,0"
                        Orientation="Horizontal">
                <Image Source="/CAION2;component/UI2/Cant_SellToNPC.png" Visibility="{Binding ExchangeVisible[0]}" />
                <Image Source="/CAION2;component/UI2/Cant_DepositeWarehouse.png" Visibility="{Binding ExchangeVisible[1]}" />
                <Image Source="/CAION2;component/UI2/Cant_DepositeWarehouseAccount.png" Visibility="{Binding ExchangeVisible[2]}" />
                <Image Source="/CAION2;component/UI2/Cant_DepositeWarehouseLegion.png" Visibility="{Binding ExchangeVisible[3]}" />
                <Image Source="/CAION2;component/UI2/Cant_ProcEnchant.png" Visibility="{Binding ExchangeVisible[4]}" />
                <Image Source="/CAION2;component/UI2/Cant_Extraction.png" Visibility="{Binding ExchangeVisible[5]}" />
                <Image Source="/CAION2;component/UI2/ExtractAbyssPoint.png" Visibility="{Binding ExchangeVisible[6]}" />
                <Image Source="/CAION2;component/UI2/ExtractSkinType_2.png" Visibility="{Binding ExchangeVisible[7]}" />
                <Image Source="/CAION2;component/UI2/Cant_ChangeSkin.png" Visibility="{Binding ExchangeVisible[8]}" />
            </StackPanel>

            <Border Grid.Row="2"
                    Margin="4,8,4,4"
                    BorderBrush="{DynamicResource ItemTextDisabled}"
                    BorderThickness="0,1,0,0">
                <StackPanel Orientation="Horizontal">
                    <TextBlock MinWidth="200"
                                MaxWidth="360"
                                Margin="0,6,0,0"
                                Text="{Binding FullCharacters}" />
                        <mui:BBCodeBlock Margin="0,6,0,0" 
                                         MaxWidth="360"
                                         BBCode="{Binding FullCharacters2}" />
                </StackPanel>
            </Border>

            <Border Grid.Row="3"
                    Margin="4,0,4,4"
                    BorderBrush="{DynamicResource ItemTextDisabled}"
                    BorderThickness="0,1,0,0"
                    Visibility="{Binding EnchantVisible}">

                <Grid Margin="0,4">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>

                    <TextBlock Margin="0,0,20,0"
                                HorizontalAlignment="Left"
                                VerticalAlignment="Center"
                                Text="{Binding EnchantLevelText}" />
                    <Slider Grid.Column="1"
                            MinWidth="50"
                            Margin="0,0,20,0"
                            IsSelectionRangeEnabled="True"
                            HorizontalAlignment="Stretch"
                            HorizontalContentAlignment="Stretch"
                            SelectionEnd="{Binding Enchant,
                                    Mode=OneWay,
                                    UpdateSourceTrigger=PropertyChanged}"
                            SelectionStart="0"
                            Maximum="{Binding MaximumEnchant}"
                            Value="{Binding Enchant,
                                            Mode=TwoWay,
                                            UpdateSourceTrigger=PropertyChanged}" />
                </Grid>

            </Border>

            <Border Grid.Row="4"
                    Margin="4,0,4,4"
                    BorderBrush="{DynamicResource ItemTextDisabled}"
                    BorderThickness="0,1,0,0"
                    Visibility="{Binding ManastonesVisible}">

                <Grid Margin="0,4">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>

                    <TextBlock Margin="0,0,10,0"
                                VerticalAlignment="Center"
                                Text="{x:Static resources:Resources.Manastones}" />

                    <StackPanel Grid.Column="1"
                                HorizontalAlignment="Center"
                                Orientation="Horizontal">
                        <Button Command="{Binding OpenManastoneCommand}"
                                CommandParameter="0"
                                Style="{StaticResource ManastoneButtonStyle}"
                                ToolTip="{Binding Manastones[0].Translate}"
                                Visibility="{Binding Manastones[0].Visible}">
                            <Image Source="{Binding Manastones[0].Icon}" />
                        </Button>
                        <Button Command="{Binding OpenManastoneCommand}"
                                CommandParameter="1"
                                Style="{StaticResource ManastoneButtonStyle}"
                                ToolTip="{Binding Manastones[1].Translate}"
                                Visibility="{Binding Manastones[1].Visible}">
                            <Image Source="{Binding Manastones[1].Icon}" />
                        </Button>
                        <Button Command="{Binding OpenManastoneCommand}"
                                CommandParameter="2"
                                Style="{StaticResource ManastoneButtonStyle}"
                                ToolTip="{Binding Manastones[2].Translate}"
                                Visibility="{Binding Manastones[2].Visible}">
                            <Image Source="{Binding Manastones[2].Icon}" />
                        </Button>
                        <Button Command="{Binding OpenManastoneCommand}"
                                CommandParameter="3"
                                Style="{StaticResource ManastoneButtonStyle}"
                                ToolTip="{Binding Manastones[3].Translate}"
                                Visibility="{Binding Manastones[3].Visible}">
                            <Image Source="{Binding Manastones[3].Icon}" />
                        </Button>
                        <Button Command="{Binding OpenManastoneCommand}"
                                CommandParameter="4"
                                Style="{StaticResource ManastoneButtonStyle}"
                                ToolTip="{Binding Manastones[4].Translate}"
                                Visibility="{Binding Manastones[4].Visible}">
                            <Image Source="{Binding Manastones[4].Icon}" />
                        </Button>
                        <Button Command="{Binding OpenManastoneCommand}"
                                CommandParameter="5"
                                Style="{StaticResource ManastoneButtonStyle}"
                                ToolTip="{Binding Manastones[5].Translate}"
                                Visibility="{Binding Manastones[5].Visible}">
                            <Image Source="{Binding Manastones[5].Icon}" />
                        </Button>
                    </StackPanel>
                </Grid>
            </Border>

            <Border Grid.Row="5"
                    Margin="4,8,4,4"
                    BorderBrush="{DynamicResource ItemTextDisabled}"
                    BorderThickness="0,1,0,0"
                    Visibility="{Binding ItemSetVisible}">
                <StackPanel HorizontalAlignment="Stretch" Orientation="Horizontal">
                    <TextBlock MaxWidth="360"
                                Margin="0,6"
                                Text="{Binding ItemSetText}"
                                Foreground="{Binding TranslateColor}"
                                TextWrapping="Wrap" >
                    </TextBlock>
                </StackPanel>
            </Border>
                
            <Border Grid.Row="6"
                    Margin="4,8,4,4"
                    BorderBrush="{DynamicResource ItemTextDisabled}"
                    BorderThickness="0,1,0,0"
                    Visibility="{Binding GodEnchantVisible}">
                <StackPanel HorizontalAlignment="Stretch" Orientation="Horizontal">
                    <mui:BBCodeBlock MaxWidth="300"
                                        Margin="0,6"
                                        BBCode="{Binding GodEnchantText}"
                                        TextWrapping="Wrap" />
                    <Slider MinWidth="50"
                            Margin="30,4,0,0"
                            HorizontalAlignment="Stretch"
                            HorizontalContentAlignment="Stretch"
                            IsSelectionRangeEnabled="True"
                            SelectionEnd="{Binding GodEnchantLevel,
                                    Mode=OneWay,
                                    UpdateSourceTrigger=PropertyChanged}"
                            SelectionStart="0"
                            Maximum="{Binding GodEnchantMaxLevel}"
                            Value="{Binding GodEnchantLevel,
                                            Mode=TwoWay,
                                            UpdateSourceTrigger=PropertyChanged}"/>
                </StackPanel>
            </Border>
                
            <Border Grid.Row="7"
                    Margin="4,8,4,4"
                    BorderBrush="{DynamicResource ItemTextDisabled}"
                    BorderThickness="0,1,0,0"
                    Visibility="{Binding RandomBonusVisible}">
                <StackPanel HorizontalAlignment="Stretch" Orientation="Horizontal">
                    <mui:BBCodeBlock MaxWidth="340"
                                        Margin="0,6"
                                        BBCode="{Binding RandomBonusText}"
                                        TextWrapping="Wrap" />
                    <mui:ModernButton Margin="10,0,0,0"
                                        Command="{Binding OpenRandomBonusCommand}"
                                        IconData="{StaticResource PlusIcon}" />
                </StackPanel>
            </Border>
                
            <Border Grid.Row="8"
                    Margin="4,8,4,4"
                    BorderBrush="{DynamicResource ItemTextDisabled}"
                    BorderThickness="0,1,0,0"
                    Visibility="{Binding IdianVisible}">
                <StackPanel HorizontalAlignment="Stretch" Orientation="Horizontal">
                    <mui:BBCodeBlock MaxWidth="340"
                                        Margin="0,6"
                                        BBCode="{Binding IdianText}"
                                        TextWrapping="Wrap" />
                    <mui:ModernButton Margin="10,0,0,0"
                                        Command="{Binding OpenIdianCommand}"
                                        IconData="{StaticResource PlusIcon}" />
                </StackPanel>
            </Border>

                

        </Grid>
        </ScrollViewer>

        <ScrollViewer HorizontalScrollBarVisibility="Disabled" 
                        VerticalScrollBarVisibility="Auto"
                        Grid.Row="1"
                        Grid.Column="1"
                        Visibility="{Binding PagesVisible[1]}">
        <Grid >
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>

            <Border Margin="4,8,30,0"
                            BorderBrush="{DynamicResource ItemTextDisabled}"
                            BorderThickness="0,1,0,0">
                <mui:BBCodeBlock Margin="0,6,0,0" BBCode="{Binding MainCharacters}" />
            </Border>

            <Border Grid.Row="1"
                            Margin="4,8,4,0"
                            BorderBrush="{DynamicResource ItemTextDisabled}"
                            BorderThickness="0,1,0,0"
                            Visibility="{Binding BonusVisible}">
                <mui:BBCodeBlock Margin="0,6,0,0" BBCode="{Binding BonusCharacters}" />
            </Border>

            <Border Grid.Row="2"
                            Margin="4,8,4,0"
                            BorderBrush="{DynamicResource ItemTextDisabled}"
                            BorderThickness="0,1,0,0"
                            Visibility="{Binding IdianVisible}">
                <mui:BBCodeBlock Margin="0,6,0,0" BBCode="{Binding IdianCharacters}" />
            </Border>

            <Border Grid.Row="3"
                            Margin="4,8,4,0"
                            BorderBrush="{DynamicResource ItemTextDisabled}"
                            BorderThickness="0,1,0,0"
                            Visibility="{Binding GodEnchantVisible}">
                <StackPanel Orientation="Vertical">
                    <mui:BBCodeBlock Margin="0,6,0,0" BBCode="{Binding GodEnchantCharactersLevel1}" Opacity="{Binding GodEnchantLevelsOpacity[0]}"/>
                    <mui:BBCodeBlock Margin="0,2,0,0" BBCode="{Binding GodEnchantCharactersLevel2}" Opacity="{Binding GodEnchantLevelsOpacity[1]}"/>
                </StackPanel>
            </Border>

            <Border Grid.Row="4"
                            Margin="4,8,4,0"
                            BorderBrush="{DynamicResource ItemTextDisabled}"
                            BorderThickness="0,1,0,0"
                            Visibility="{Binding RandomBonusVisible}">
                <mui:BBCodeBlock Margin="0,6,0,0" BBCode="{Binding RandomBonusCharacters}" />
            </Border>

            <Border Grid.Row="5"
                            Margin="4,8,4,0"
                            BorderBrush="{DynamicResource ItemTextDisabled}"
                            BorderThickness="0,1,0,0"
                            Visibility="{Binding ManastonesVisible}">

                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>

                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>

                    <mui:BBCodeBlock Grid.ColumnSpan="2"
                                                Margin="0,6"
                                                BBCode="{Binding ManastoneText}"
                                                TextWrapping="Wrap" />

                    <StackPanel Grid.Row="1" Grid.Column="0" Orientation="Vertical">
                        <StackPanel Orientation="Horizontal">
                            <Button Command="{Binding OpenManastoneCommand}"
                                            CommandParameter="0"
                                            Style="{StaticResource ManastoneButtonStyle}"
                                            Visibility="{Binding Manastones[0].Visible}">
                                <Image Source="{Binding Manastones[0].Icon}" />
                            </Button>
                            <TextBlock VerticalAlignment="Center" Text="{Binding Manastones[0].Translate}" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Button Command="{Binding OpenManastoneCommand}"
                                            CommandParameter="2"
                                            Style="{StaticResource ManastoneButtonStyle}"
                                            Visibility="{Binding Manastones[2].Visible}">
                                <Image Source="{Binding Manastones[2].Icon}" />
                            </Button>
                            <TextBlock VerticalAlignment="Center" Text="{Binding Manastones[2].Translate}" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Button Command="{Binding OpenManastoneCommand}"
                                            CommandParameter="4"
                                            Style="{StaticResource ManastoneButtonStyle}"
                                            Visibility="{Binding Manastones[4].Visible}">
                                <Image Source="{Binding Manastones[4].Icon}" />
                            </Button>
                            <TextBlock VerticalAlignment="Center" Text="{Binding Manastones[4].Translate}" />
                        </StackPanel>
                    </StackPanel>

                    <StackPanel Grid.Row="1"
                                        Grid.Column="1"
                                        Orientation="Vertical">
                        <StackPanel Orientation="Horizontal">
                            <Button Command="{Binding OpenManastoneCommand}"
                                            CommandParameter="1"
                                            Style="{StaticResource ManastoneButtonStyle}"
                                            Visibility="{Binding Manastones[1].Visible}">
                                <Image Source="{Binding Manastones[1].Icon}" />
                            </Button>
                            <TextBlock VerticalAlignment="Center" Text="{Binding Manastones[1].Translate}" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Button Command="{Binding OpenManastoneCommand}"
                                            CommandParameter="3"
                                            Style="{StaticResource ManastoneButtonStyle}"
                                            Visibility="{Binding Manastones[3].Visible}">
                                <Image Source="{Binding Manastones[3].Icon}" />
                            </Button>
                            <TextBlock VerticalAlignment="Center" Text="{Binding Manastones[3].Translate}" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Button Command="{Binding OpenManastoneCommand}"
                                            CommandParameter="5"
                                            Style="{StaticResource ManastoneButtonStyle}"
                                            Visibility="{Binding Manastones[5].Visible}">
                                <Image Source="{Binding Manastones[5].Icon}" />
                            </Button>
                            <TextBlock VerticalAlignment="Center" Text="{Binding Manastones[5].Translate}" />
                        </StackPanel>
                    </StackPanel>
                </Grid>
            </Border>

            <Border Grid.Row="6"
                            Margin="4,8,4,0"
                            BorderBrush="{DynamicResource ItemTextDisabled}"
                            BorderThickness="0,1,0,0"
                            Visibility="{Binding ItemSetVisible}">
                <mui:BBCodeBlock Margin="0,6,0,0" BBCode="{Binding ItemSetCharacters}" />
            </Border>

            <Border Grid.Row="7"
                            Margin="4,8,4,0"
                            BorderBrush="{DynamicResource ItemTextDisabled}"
                            BorderThickness="0,1,0,0"
                            Visibility="{Binding ArmsfusionVisible}">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>

                    <TextBlock Margin="0,6,10,0"
                                        VerticalAlignment="Top"
                                        HorizontalAlignment="Left"
                                        Foreground="{Binding ArmsfusionTitleColor}"
                                        Text="{x:Static resources:Resources.Armsfusion_Title}" />

                    <Border Grid.Row="1"
                                    Margin="4,8,4,0"
                                    BorderBrush="{DynamicResource ItemTextDisabled}"
                                    BorderThickness="0,1,0,0"
                                    Visibility="{Binding ArmsfusionBonusVisible}">
                        <mui:BBCodeBlock Margin="0,6,0,0" BBCode="{Binding ArmsfusionBonusCharacters}" />
                    </Border>

                    <Border Grid.Row="2"
                                    Margin="4,8,4,0"
                                    BorderBrush="{DynamicResource ItemTextDisabled}"
                                    BorderThickness="0,1,0,0"
                                    Visibility="{Binding ArmsfusionManastonesVisible}">

                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>

                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="*" />
                            </Grid.RowDefinitions>

                            <mui:BBCodeBlock Grid.ColumnSpan="2"
                                                Margin="0,6"
                                                BBCode="{Binding ArmsfusionManastoneText}"
                                                TextWrapping="Wrap" />

                            <StackPanel Grid.Row="1" Grid.Column="0" Orientation="Vertical">
                                <StackPanel Orientation="Horizontal">
                                    <Button Command="{Binding OpenArmsfusionManastoneCommand}"
                                            CommandParameter="0"
                                            Style="{StaticResource ArmsfusionManastoneButtonStyle}"
                                            Visibility="{Binding ArmsfusionManastones[0].Visible}">
                                        <Image Source="{Binding ArmsfusionManastones[0].Icon}" />
                                    </Button>
                                    <TextBlock VerticalAlignment="Center" Text="{Binding ArmsfusionManastones[0].Translate}" />
                                </StackPanel>
                                <StackPanel Orientation="Horizontal">
                                    <Button Command="{Binding OpenArmsfusionManastoneCommand}"
                                            CommandParameter="2"
                                            Style="{StaticResource ArmsfusionManastoneButtonStyle}"
                                            Visibility="{Binding ArmsfusionManastones[2].Visible}">
                                        <Image Source="{Binding ArmsfusionManastones[2].Icon}" />
                                    </Button>
                                    <TextBlock VerticalAlignment="Center" Text="{Binding ArmsfusionManastones[2].Translate}" />
                                </StackPanel>
                                <StackPanel Orientation="Horizontal">
                                    <Button Command="{Binding OpenArmsfusionManastoneCommand}"
                                            CommandParameter="4"
                                            Style="{StaticResource ArmsfusionManastoneButtonStyle}"
                                            Visibility="{Binding ArmsfusionManastones[4].Visible}">
                                        <Image Source="{Binding ArmsfusionManastones[4].Icon}" />
                                    </Button>
                                    <TextBlock VerticalAlignment="Center" Text="{Binding ArmsfusionManastones[4].Translate}" />
                                </StackPanel>
                            </StackPanel>

                            <StackPanel Grid.Row="1"
                                        Grid.Column="1"
                                        Orientation="Vertical">
                                <StackPanel Orientation="Horizontal">
                                    <Button Command="{Binding OpenArmsfusionManastoneCommand}"
                                            CommandParameter="1"
                                            Style="{StaticResource ArmsfusionManastoneButtonStyle}"
                                            Visibility="{Binding ArmsfusionManastones[1].Visible}">
                                        <Image Source="{Binding ArmsfusionManastones[1].Icon}" />
                                    </Button>
                                    <TextBlock VerticalAlignment="Center" Text="{Binding ArmsfusionManastones[1].Translate}" />
                                </StackPanel>
                                <StackPanel Orientation="Horizontal">
                                    <Button Command="{Binding OpenArmsfusionManastoneCommand}"
                                            CommandParameter="3"
                                            Style="{StaticResource ArmsfusionManastoneButtonStyle}"
                                            Visibility="{Binding ArmsfusionManastones[3].Visible}">
                                        <Image Source="{Binding ArmsfusionManastones[3].Icon}" />
                                    </Button>
                                    <TextBlock VerticalAlignment="Center" Text="{Binding ArmsfusionManastones[3].Translate}" />
                                </StackPanel>
                                <StackPanel Orientation="Horizontal">
                                    <Button Command="{Binding OpenArmsfusionManastoneCommand}"
                                            CommandParameter="5"
                                            Style="{StaticResource ArmsfusionManastoneButtonStyle}"
                                            Visibility="{Binding ArmsfusionManastones[5].Visible}">
                                        <Image Source="{Binding ArmsfusionManastones[5].Icon}" />
                                    </Button>
                                    <TextBlock VerticalAlignment="Center" Text="{Binding ArmsfusionManastones[5].Translate}" />
                                </StackPanel>
                            </StackPanel>
                        </Grid>
                    </Border>

                </Grid>
            </Border>

        </Grid>
        </ScrollViewer>

        <ScrollViewer HorizontalScrollBarVisibility="Disabled" 
                        VerticalScrollBarVisibility="Auto"
                        Grid.Row="1"
                        Grid.Column="1"
                        Visibility="{Binding PagesVisible[2]}">
        <Grid >
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>

            <Border Margin="4,8,30,0"
                    BorderBrush="{DynamicResource ItemTextDisabled}"
                    BorderThickness="0,1,0,0">
                <StackPanel Margin="0,6,0,0" Orientation="Vertical">

                    <StackPanel Height="24"
                                Orientation="Horizontal"
                                Visibility="{Binding ExchangeVisible[0]}">
                        <Image Source="/CAION2;component/UI2/Cant_SellToNPC.png" />
                        <TextBlock Text="{x:Static resources:Resources.Exchange_CantSellToNPC}" />
                    </StackPanel>
                    <StackPanel Height="24"
                                Orientation="Horizontal"
                                Visibility="{Binding ExchangeVisible[1]}">
                        <Image Source="/CAION2;component/UI2/Cant_DepositeWarehouse.png" />
                        <TextBlock Text="{x:Static resources:Resources.Exchange_CantDepositeWarehouse}" />
                    </StackPanel>
                    <StackPanel Height="24"
                                Orientation="Horizontal"
                                Visibility="{Binding ExchangeVisible[2]}">
                        <Image Source="/CAION2;component/UI2/Cant_DepositeWarehouseAccount.png" />
                        <TextBlock Text="{x:Static resources:Resources.Exchange_CantDepositeWarehouseAccount}" />
                    </StackPanel>
                    <StackPanel Height="24"
                                Orientation="Horizontal"
                                Visibility="{Binding ExchangeVisible[3]}">
                        <Image Source="/CAION2;component/UI2/Cant_DepositeWarehouseLegion.png" />
                        <TextBlock Text="{x:Static resources:Resources.Exchange_CantDepositeWarehouseLegion}" />
                    </StackPanel>
                    <StackPanel Height="24"
                                Orientation="Horizontal"
                                Visibility="{Binding ExchangeVisible[4]}">
                        <Image Source="/CAION2;component/UI2/Cant_ProcEnchant.png" />
                        <TextBlock Text="{x:Static resources:Resources.Exchange_CantProcEnchant}" />
                    </StackPanel>
                    <StackPanel Height="24"
                                Orientation="Horizontal"
                                Visibility="{Binding ExchangeVisible[5]}">
                        <Image Source="/CAION2;component/UI2/Cant_Extraction.png" />
                        <TextBlock Text="{x:Static resources:Resources.Exchange_CantExtraction}" />
                    </StackPanel>
                    <StackPanel Height="24"
                                Orientation="Horizontal"
                                Visibility="{Binding ExchangeVisible[6]}">
                        <Image Source="/CAION2;component/UI2/ExtractAbyssPoint.png" />
                        <TextBlock Text="{x:Static resources:Resources.Exchange_CanExtractAP}" />
                    </StackPanel>
                    <StackPanel Height="24"
                                Orientation="Horizontal"
                                Visibility="{Binding ExchangeVisible[7]}">
                        <Image Source="/CAION2;component/UI2/ExtractSkinType_2.png" />
                        <TextBlock Text="{x:Static resources:Resources.Exchange_ExtractSkinType_2}" />
                    </StackPanel>
                    <StackPanel Height="24"
                                Orientation="Horizontal"
                                Visibility="{Binding ExchangeVisible[8]}">
                        <Image Source="/CAION2;component/UI2/Cant_ChangeSkin.png" />
                        <TextBlock Text="{x:Static resources:Resources.Exchange_CantChangeSkin}" />
                    </StackPanel>
                </StackPanel>
            </Border>

            <Border Grid.Row="1"
                    Margin="4,10,30,0"
                    BorderBrush="{DynamicResource ItemTextDisabled}"
                    BorderThickness="0,1,0,0">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>

                    <StackPanel Grid.Row="1"
                                HorizontalAlignment="Stretch"
                                Orientation="Horizontal"
                                Margin="0,6,0,0"
                                Visibility="{Binding AbyssPointsVisible[0]}">
                        <TextBlock HorizontalAlignment="Left"
                                VerticalAlignment="Center"
                                Text="{Binding Item[extra_currency_item_count],
                                                ConverterCulture='ru-RU',
                                                StringFormat={}{0:N0}}"
                                TextAlignment="Right" />
                            
                        <Image MaxWidth="30"
                            MaxHeight="30"
                            Margin="10,0,0,0"
                            HorizontalAlignment="Left"
                            VerticalAlignment="Center"
                            Source="{Binding ExtraCurrencyIcon,
                                            Converter={StaticResource IconConverter}}"
                            Stretch="Uniform" />

                        <TextBlock Margin="10,0,0,0"
                                HorizontalAlignment="Left"
                                VerticalAlignment="Center"
                                Text="{Binding ExtraCurrencyName}" />
                    </StackPanel>
                        
                    <StackPanel Grid.Row="0" 
                                Margin="0,6,0,0"
                                Orientation="Horizontal"
                                HorizontalAlignment="Stretch" 
                                Visibility="{Binding AbyssPointsVisible[1]}">
                        <TextBlock HorizontalAlignment="Left"
                                VerticalAlignment="Center"
                                Text="{Binding Item[abyss_point],
                                                ConverterCulture='ru-RU',
                                                StringFormat={}{0:N0}}"
                                TextAlignment="Right" />

                        <Image MaxWidth="16"
                                MaxHeight="16"
                            Margin="10,0,0,0"
                            HorizontalAlignment="Left"
                            VerticalAlignment="Center"
                            Source="/CAION2;component/UI2/AbyssPoints.png"
                            Stretch="Uniform" />

                        <TextBlock Margin="10,0,0,0"
                                HorizontalAlignment="Left"
                                VerticalAlignment="Center"
                                Text="{x:Static resources:Resources.AbyssPoints}" />
                    </StackPanel>
                        
                    <ItemsControl Grid.Row="2"
                                    Margin="4,16,0,0"
                                    ItemsSource="{Binding Coins,
                                                        Mode=OneWay,
                                                        UpdateSourceTrigger=PropertyChanged}">
                        <ItemsControl.ItemsPanel>
                            <ItemsPanelTemplate>
                                <StackPanel Orientation="Vertical" />
                            </ItemsPanelTemplate>
                        </ItemsControl.ItemsPanel>
                        <ItemsControl.ItemTemplate>
                            <DataTemplate>
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="55" />
                                        <ColumnDefinition Width="40" />
                                        <ColumnDefinition Width="*" />
                                    </Grid.ColumnDefinitions>

                                    <TextBlock Margin="10,0,0,0"
                                                VerticalAlignment="Center"
                                                Text="{Binding [Coin_need],
                                                                ConverterCulture='ru-RU',
                                                                StringFormat={}{0:N0}}"
                                                TextAlignment="Right" />

                                    <Image Grid.Column="1"
                                            Width="20"
                                            Height="20"
                                            Margin="15,4,0,0"
                                            HorizontalAlignment="Left"
                                            VerticalAlignment="Center"
                                            Source="{Binding [Icon_name],
                                                            Converter={StaticResource IconConverter}}"
                                            Stretch="Uniform" />

                                    <TextBlock Grid.Column="2"
                                                VerticalAlignment="Center"
                                                Text="{Binding [Translate]}"
                                                TextWrapping="Wrap" />


                                </Grid>
                            </DataTemplate>
                        </ItemsControl.ItemTemplate>
                    </ItemsControl>

                </Grid>
            </Border>

            <Border Grid.Row="2"
                    Margin="4,10,30,0"
                    BorderBrush="{DynamicResource ItemTextDisabled}"
                    BorderThickness="0,1,0,0">
                    
                <StackPanel Orientation="Horizontal"
                            Margin="0,10,0,0"
                            Height="20"
                            VerticalAlignment="Top">
                    
                        <TextBlock Text="{x:Static resources:Resources.GameId}"
                                   Margin="0,0,10,0"/>
                    
                        <TextBox Text="{Binding ItemId}"
                                 IsReadOnly="True"/>
                    
                        <mui:ModernButton Command="{Binding CopyIdToClipboardCommand}"
                                          IconData="{StaticResource CopyIcon}"
                                          ToolTip="{x:Static resources:Resources.CardCopyIdToolTip}"
                                          Margin="10,0,0,0"/>
                    
                    </StackPanel>
                
                
            </Border>
            
        </Grid>
        </ScrollViewer>

        <Border Grid.Row="2"
                Grid.ColumnSpan="2" 
                Grid.Column="0"
                BorderBrush="{DynamicResource ItemTextDisabled}"
                BorderThickness="0,1,0,0">
            <StackPanel Margin="0,10,0,0"
                        HorizontalAlignment="Center"
                        VerticalAlignment="Top"
                        Orientation="Horizontal">
                <RadioButton Command="{Binding PageSelectCommand}"
                                CommandParameter="1"
                                IsChecked="{Binding FirstPageChecked}" />
                <RadioButton Command="{Binding PageSelectCommand}" CommandParameter="2" />
                <RadioButton Command="{Binding PageSelectCommand}" CommandParameter="3" />
            </StackPanel>
        </Border>

    </Grid>
    

</UserControl>
